//
//  ZHMyHelpViewController.m
//  LoveFreshBee
//
//  Created by brice Mac on 2016/10/19.
//  Copyright © 2016年 王忠迪. All rights reserved.
//

#define subViewHeight 50
#define navHeight 64

#import "ZHMyHelpViewController.h"
#import "CommonViewController.h"

@interface ZHMyHelpViewController ()

@end

@implementation ZHMyHelpViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupMyHelpViewUI];
}

/**
 空实现父类的这个方法，根view就不是tableView了
 */
- (void)setupTableView {
    
}

- (void)setupMyHelpViewUI {
    
    //客服电话
    //点击该View会弹出一个 AlertView
    UIView *servePhoneView = [[UIView alloc]initWithFrame:CGRectMake(0, navHeight + 11, kScreenW, 50)];
    servePhoneView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:servePhoneView];
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(servePhoneViewClick)];
    
    [servePhoneView addGestureRecognizer:tap];
    
    UILabel *serviceLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 0, 200, 50)];
    serviceLabel.text = @"客服电话: 400-8484-482";
    serviceLabel.font = [UIFont systemFontOfSize:16];
    [servePhoneView addSubview:serviceLabel];
    
    UIImageView *arrowView1 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"icon_go"]];
    arrowView1.frame = CGRectMake(kScreenW - 30, 20, 5, 10);
    [servePhoneView addSubview:arrowView1];
    
    //常见问题View
    //点击会进入常见问题页面
    UIView *commonIssueView = [[UIView alloc] initWithFrame:CGRectMake(0,  subViewHeight + navHeight + 11, kScreenW, subViewHeight)];
    commonIssueView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:commonIssueView];
    
    UITapGestureRecognizer *touch = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(commonIssueViewClick)];
    
    [commonIssueView addGestureRecognizer:touch];
    
    UILabel *commonIssueLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 0, 200, subViewHeight)];
    commonIssueLabel.text = @"常见问题";
    commonIssueLabel.font = [UIFont systemFontOfSize:16];
    [commonIssueView addSubview:commonIssueLabel];
    
    UIImageView *arrowView2 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"icon_go"]];
    arrowView2.frame = CGRectMake(kScreenW - 30, 20, 5, 10);
    [commonIssueView addSubview:arrowView2];
    
    UIView *line = [[UIView alloc]initWithFrame:CGRectMake(5, -0.5, kScreenW - 10, 0.5)];
    line.backgroundColor = [UIColor blackColor];
    line.alpha = 0.2;
    [commonIssueView addSubview:line];
}


- (void)servePhoneViewClick {
    
    UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"400-8484-842" message:nil preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction* action1 = [UIAlertAction actionWithTitle:@"拨打" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    
    [alert addAction:action1];
    
    UIAlertAction* action5 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    
    [alert addAction:action5];
    
    [self presentViewController:alert animated:YES completion:^{
        
    }];
    
}


/**
    跳转常见问题网页 WebView
 */
- (void)commonIssueViewClick {
    
    CommonViewController *issue = [[CommonViewController alloc]init];
    issue.navItem.title = @"常见问题";
    [self.navigationController pushViewController:issue animated:YES];
}


@end





